VBS如何执行带""的cmd命令

来源:百度知道 编辑:UC知道 时间:2024/06/23 19:53:52
看看下面的例子,cmd命令本身带"",而vbs又带""的,要如何才可以执行:

set ws=wscript.Createobject("wscript.shell")
ws.run "cmd /c copy test.txt "c:\Documents and Settings"",0

ws.run "cmd /c copy test.txt ""c:\Documents and Settings""",0

set ws=wscript.Createobject("wscript.shell")
ws.run chr(34) $ "cmd /c copy test.txt c:\Documents and Settings"&chr(34),0

run "cmd /c copy test.txt ""c:\Documents and Settings""",0

将里面的改成单引号就可以了
set ws=wscript.Createobject("wscript.shell")
ws.run "cmd /c copy test.txt 'c:\Documents and Settings'",0